

**************************************************************
***************** Figure 2: Data Availability Map *****************
**************************************************************

clear 
use Data_Law_08132018.dta
merge 1:1 country_year using Data_Controls_10112017, force
drop if _merge==2
drop _merge

keep if year==2010
kountry country, from(other) stuck
ren _ISO3N_ iso3n
kountry iso3n, from(iso3n) to(iso3c)
ren _ISO3C_ ISO3
replace ISO3="JEY" if country=="Jersey Channel Islands"
drop if ISO3==""

merge 1:1 ISO3 using worlddb
drop if NAME=="Antarctica"
drop if _merge==2

tab year

#delimit;
*P_corr_usa;
spmap national_law_coded_ever using worldcoord,
	id(_ID) clm(custom) clb(0 0.9 1) graphregion(fcolor(white) color(white))
	fcolor(white "255 180 180") name(antitrustdataavailable, replace);
graph export "antitrustdataavailable.pdf", replace;


**************************************************************
***************** Figure 3: Goals			 *****************
**************************************************************

clear
use Data_Law_08132018.dta, clear

preserve
keep if year >1949
keep if year <2011
drop if regional_group==1
drop if national_law_coded_ever==0
drop if law_in_place==0


gen neither= 1
gen efficiency= 0
gen other= 0
gen  both= 0

replace efficiency=1 if goals_cosumer_welfa==1 | goals_efficiency ==1 | goals_total_welfare ==1 
replace efficiency = 0 if goals_protect_smallmid!=0| goals_protect_exports !=0|goals_industrial_policy !=0|goals_social_policy !=0|goals_development!=0| goals_other!=0

replace other = 1 if goals_protect_smallmid==1| goals_protect_exports ==1|goals_industrial_policy ==1|goals_social_policy ==1|goals_development==1| goals_other==1
replace other=0 if goals_cosumer_welfa==1 | goals_efficiency ==1 | goals_total_welfare ==1 

replace both =1 if goals_cosumer_welfa==1 | goals_efficiency ==1 | goals_total_welfare ==1 | goals_protect_smallmid==1| goals_protect_exports ==1|goals_industrial_policy ==1|goals_social_policy ==1|goals_development==1| goals_other==1
replace both =0 if efficiency==1 | other==1

replace neither =0 if efficiency==1 | both==1 | other ==1

summarize efficiency other both neither if year==2010
tab efficiency if year==2010
tab other if year==2010
tab both if year ==2010
tab neither if year ==2010

*** The percent of countries with goals that only have efficiency related goals is 17 / (17+20+41) = 22%

summarize goals_generic goals_cosumer_welfare goals_total_welfare goals_efficiency efficiency  if year==2010


egen EFF = mean(efficiency), by(year)
egen OTHER = mean(other), by(year)
egen BOTH = mean(both), by(year)
egen NEITHER = mean(neither), by(year)

egen tag = tag(year)
twoway line EFF OTHER BOTH NEITHER year if tag, sort saving(EU_converge) graphregion(color(white)) bgcolor(white) xtitle("Year") ytitle("Proportion") legend(label(1 "Efficiency-Related Goals") label(2 "Non-Efficiency Related Goals") label(3 "Both Types of Goals") label(4 "No Explicit Goals")) lpattern(1 _ shortdash_dot longdash) xla(1950(10)2010) yla(0(.1)1.05)


tab 

**************************************************************
***************** Figure 4: Exemptions		 *****************
**************************************************************

clear
graph drop _all 
erase exempt_soe.gph
erase exempt_other.gph
use Data_Law_08132018.dta, clear

preserve
keep if year >1949
keep if year <2011
drop if regional_group==1
drop if national_law_coded_ever==0
drop if law_in_place==0

gen soe =0
replace soe =1 if exempt_state_owned_complete ==1 |exempt_state_operated_complete==1 

tab soe if year ==1990 
tab soe if year == 2010

egen EFF = mean(soe), by(year)

egen tag = tag(year)
twoway line EFF year if tag, sort saving(exempt_soe) graphregion(color(white)) bgcolor(white) xtitle("Year") ytitle("Proportion") title("A. State Owned / Operated Enterprises") lpattern(1 _ shortdash_dot longdash) xla(1950(10)2010) yla(0(.1)1.05)



clear
use Data_Law_08132018.dta, clear

* preserve
keep if year >1949
keep if year <2011
drop if regional_group==1
drop if national_law_coded_ever==0
drop if law_in_place==0

gen exempt =0
replace exempt =1 if exempt_export_cartel_complete ==1 | exempt_des_monopolies_complete ==1 |exempt_other_complete ==1 

tab exempt if year ==1980
tab exempt if year ==1990 
tab exempt if year == 2010

egen EFF = mean(exempt), by(year)

egen tag = tag(year)
twoway line EFF year if tag, sort saving(exempt_other) graphregion(color(white)) bgcolor(white) xtitle("Year") ytitle("Proportion") title("B. Other Enterprise Categories") lpattern(1 _ shortdash_dot longdash) xla(1950(10)2010) yla(0(.1)1.05)


gr combine exempt_soe.gph exempt_other.gph


clear
use Data_Law_08132018.dta, clear

keep if year >1949
keep if year <2011
drop if regional_group==1
drop if national_law_coded_ever==0
drop if law_in_place==0


gen combine =0
replace combine =1 if exempt_export_cartel_complete ==1 | exempt_des_monopolies_complete ==1 |exempt_other_complete ==1 |exempt_export_cartel_complete ==1 | exempt_des_monopolies_complete ==1 |exempt_other_complete ==1 

tab combine if year ==1990 
tab combine if year == 2010

**************************************************************
***************** Figure 5: Industries	 *****************
**************************************************************


clear
use Data_Law_08132018.dta, clear

preserve
keep if year >1949
keep if year <2011
drop if regional_group==1
drop if national_law_coded_ever==0
drop if law_in_place==0

egen EFF = mean(exempt_industry), by(year)
tab exempt_industry if year ==1950
tab exempt_industry if year ==1990
tab exempt_industry if year ==2010

egen tag = tag(year)
twoway line EFF year if tag, sort saving(EU_converge) graphregion(color(white)) bgcolor(white) xtitle("Year") ytitle("Proportion")  lpattern(1 _ shortdash_dot longdash) xla(1950(10)2010) yla(0(.1)1.05)


**************************************************************
***************** Figure 6: Merger Defenses		 *****************
**************************************************************

clear
use Data_Law_08132018.dta, clear


preserve
keep if year >1949
keep if year <2011
drop if regional_group==1
drop if national_law_coded_ever==0
drop if law_in_place==0

gen neither= 1
gen efficiency= 0
gen other= 0
gen  both= 0

replace efficiency=1 if merger_efficiency_def==1 
replace efficiency = 0 if merger_pubint_def!=0

replace other = 1 if merger_pubint_def==1
replace other=0 if  merger_efficiency_def==1 

replace both =1 if merger_efficiency_def==1 |  merger_pubint_def ==1 
replace both =0 if efficiency==1 | other==1

replace neither =0 if efficiency==1 | both==1 | other ==1

summarize efficiency other both neither if year==2010
summarize  merger_efficiency_def merger_pubint_def if year==2010


egen EFF = mean(efficiency), by(year)
egen OTHER = mean(other), by(year)
egen BOTH = mean(both), by(year)
egen NEITHER = mean(neither), by(year)

egen tag = tag(year)
twoway line EFF OTHER BOTH NEITHER year if tag, sort saving(EU_converge) graphregion(color(white)) bgcolor(white) xtitle("Year") ytitle("Proportion") legend(label(1 "Efficiency Defense") label(2 "Public Interest Defense") label(3 "Both") label(4 "Neither")) lpattern(1 _ shortdash_dot longdash) xla(1950(10)2010) yla(0(.1)1.05)



**************************************************************
***************** Figure 7: Merger Mandatory Notification			 *****************
**************************************************************

clear
use Data_Law_08132018.dta, clear

preserve
keep if year >1949
keep if year <2011
drop if regional_group==1
drop if national_law_coded_ever==0
drop if law_in_place==0


gen prenot = 0
replace prenot = 1 if merger_not_mandatory_before==1

tab prenot if year ==1950
tab prenot if year ==1970
tab prenot if year ==1980
tab prenot if year ==1990
tab prenot if year ==2010

egen EFF = mean(prenot), by(year)

egen tag = tag(year)
twoway line EFF year if tag, sort saving(prenot) graphregion(color(white)) bgcolor(white) xtitle("Year") ytitle("Proportion")  lpattern(1 _ shortdash_dot longdash) xla(1950(10)2010) yla(0(.1)1.05)


**************************************************************
***************** Figure 8: Mergers Restricted		 *****************
**************************************************************


erase merger_stopped.gph

clear
use Data_Law_08132018.dta, clear

merge country_year using Data_Enforcement_08282017.dta, sort
drop _merge

preserve
keep if year >1990
keep if year <2011
drop if regional_group==1
drop if national_law_coded_ever==0

tab merger_stopped year

egen EFF = sum(merger_stopped), by(year)
tab year EFF

egen tag = tag(year)
twoway line EFF year if tag, sort saving(merger_stopped) graphregion(color(white)) bgcolor(white) xtitle("Year") ytitle("Number") lpattern(1 _ shortdash_dot longdash) xla(1990(5)2010) yla(0(250)1050) ylin(1000)



**************************************************************
***************** Figure 9: Unilateral Conduct	 *****************
**************************************************************


*** NOTE!!!!!! We need to make a new version of this figure that drops countries without a law. 

dominance_discounts dominance_unfair_pricing dominance_discrim_pricing dominance_price_maintenance dominance_efficiency_def dominance_pubint_def

erase discounts.gph
erase unfairpricing.gph 
erase discrim.gph 
erase rpm.gph 
erase efficiency.gph 
erase pubint.gph


clear
use Data_Law_08132018.dta, clear

keep if year >1949
keep if year <2011
drop if regional_group==1
drop if national_law_coded_ever==0
drop if law_in_place==0

egen EFF = mean(dominance_discounts), by(year)
tab EFF year

egen tag = tag(year)
twoway line EFF year if tag, sort saving(discounts) title("Discounts",color(black)) graphregion(color(white)) bgcolor(white) xtitle("Year") ytitle("Proportion")  lpattern(1 _ shortdash_dot longdash) xla(1950(10)2010) yla(0(.2)1.05)

*2
clear
use Data_Law_08132018.dta, clear

keep if year >1949
keep if year <2011
drop if regional_group==1
drop if national_law_coded_ever==0
drop if law_in_place==0


egen EFF = mean(dominance_unfair_pricing), by(year)
tab EFF year

egen tag = tag(year)
twoway line EFF year if tag, sort saving(unfairpricing) title("Unfair Pricing",color(black)) graphregion(color(white)) bgcolor(white) xtitle("Year") ytitle("Proportion")  lpattern(1 _ shortdash_dot longdash) xla(1950(10)2010) yla(0(.2)1.05)

*3
clear
use Data_Law_08132018.dta, clear

keep if year >1949
keep if year <2011
drop if regional_group==1
drop if national_law_coded_ever==0
drop if law_in_place==0


egen EFF = mean(dominance_discrim_pricing), by(year)
tab EFF year

egen tag = tag(year)
twoway line EFF year if tag, sort saving(discrim) title("Discriminatory Pricing",color(black)) graphregion(color(white)) bgcolor(white) xtitle("Year") ytitle("Proportion")  lpattern(1 _ shortdash_dot longdash) xla(1950(10)2010) yla(0(.2)1.05)


*4 
clear
use Data_Law_08132018.dta, clear

keep if year >1949
keep if year <2011
drop if regional_group==1
drop if national_law_coded_ever==0
drop if law_in_place==0


egen EFF = mean(dominance_price_maintenance), by(year)
tab EFF year

egen tag = tag(year)
twoway line EFF year if tag, sort saving(rpm) title("Retail Price Maintence",color(black)) graphregion(color(white)) bgcolor(white) xtitle("Year") ytitle("Proportion")  lpattern(1 _ shortdash_dot longdash) xla(1950(10)2010) yla(0(.2)1.05)

*5
clear
use Data_Law_08132018.dta, clear

keep if year >1949
keep if year <2011
drop if regional_group==1
drop if national_law_coded_ever==0
drop if law_in_place==0


egen EFF = mean(dominance_efficiency_def), by(year)
tab EFF year

egen tag = tag(year)
twoway line EFF year if tag, sort saving(efficiency) title("Efficiency Defense",color(black)) graphregion(color(white)) bgcolor(white) xtitle("Year") ytitle("Proportion")  lpattern(1 _ shortdash_dot longdash) xla(1950(10)2010) yla(0(.2)1.05)

* 6
clear
use Data_Law_08132018.dta, clear

keep if year >1949
keep if year <2011
drop if regional_group==1
drop if national_law_coded_ever==0
drop if law_in_place==0

egen EFF = mean(dominance_pubint_def), by(year)
tab EFF year


egen tag = tag(year)
twoway line EFF year if tag, sort saving(pubint) title("Public Interest Defense",color(black)) graphregion(color(white)) bgcolor(white) xtitle("Year") ytitle("Proportion")  lpattern(1 _ shortdash_dot longdash) xla(1950(10)2010) yla(0(.2)1.05)



gr combine discounts.gph unfairpricing.gph discrim.gph rpm.gph efficiency.gph pubint.gph,col(2)



**************************************************************
***************** Figure 10: Cartels v. Dominance		 *****************
**************************************************************

erase cartel.gph
erase dominance.gph
erase cartel_remedy.gph
erase dominance_remedy.gph

clear
use Data_Law_08132018.dta, clear

merge country_year using Data_Enforcement_08282017.dta, sort
drop _merge

preserve
keep if year >1990
keep if year <2011
drop if regional_group==1
drop if national_law_coded_ever==0

egen EFF = sum(cartel_investig_total), by(year)
tab EFF year

egen tag = tag(year)
twoway line EFF year if tag, sort saving(cartel) graphregion(color(white)) bgcolor(white) xtitle("Year") ytitle("Number") title("(A) Cartels - Investigations",color(black)) lpattern(1 _ shortdash_dot longdash) xla(1990(5)2010) yla(0(1000)4100) ylin(4000)


* 2nd Graph
clear
use Data_Law_08132018.dta, clear

merge country_year using Data_Enforcement_08282017.dta, sort
drop _merge

keep if year >1990
keep if year <2011
drop if regional_group==1
drop if national_law_coded_ever==0

egen EFF = sum(dominance_investig_total), by(year)
tab EFF year

egen tag = tag(year)
twoway line EFF year if tag, sort saving(dominance) graphregion(color(white)) bgcolor(white) xtitle("Year") ytitle("Number") title("(B) Unilateral Conduct - Investigations",color(black)) lpattern(1 _ shortdash_dot longdash) xla(1990(5)2010) yla(0(1000)4100) ylin(4000)

*3rd Graph
clear
use Data_Law_08132018.dta, clear

merge country_year using Data_Enforcement_08282017.dta, sort
drop _merge

*preserve
keep if year >1990
keep if year <2011
drop if regional_group==1
drop if national_law_coded_ever==0

egen EFF = sum(cartel_remedy_total), by(year)
tab EFF year

egen tag = tag(year)
twoway line EFF year if tag, sort saving(cartel_remedy) graphregion(color(white)) bgcolor(white) xtitle("Year") ytitle("Number") title("(C) Cartels - Remedies",color(black)) lpattern(1 _ shortdash_dot longdash) xla(1990(5)2010) yla(0(500)2100) ylin(2000)

*4th Graph
clear
use Data_Law_08132018.dta, clear

merge country_year using Data_Enforcement_08282017.dta, sort
drop _merge

keep if year >1990
keep if year <2011
drop if regional_group==1
drop if national_law_coded_ever==0

egen EFF = sum(dominance_remedy_total), by(year)
tab EFF year

egen tag = tag(year)
twoway line EFF year if tag, sort saving(dominance_remedy) graphregion(color(white)) bgcolor(white) xtitle("Year") ytitle("Number") title("(D) Unilateral Conduct - Remedies",color(black)) lpattern(1 _ shortdash_dot longdash) xla(1990(5)2010) yla(0(500)2100) ylin(2000)


gr combine cartel.gph dominance.gph cartel_remedy.gph dominance_remedy.gph,col(2)


************ Investigating things withour 

*4th Graph
clear
use Data_Law_08132018.dta, clear

merge country_year using Data_Enforcement_08282017.dta, sort
drop _merge

keep if year >1990
keep if year <2011
drop if regional_group==1
drop if national_law_coded_ever==0

egen EFF = sum(dominance_remedy_total), by(year)
tab EFF year

browse country year cartel_investig_total cartel_remedy_total dominance_investig_total dominance_remedy_total 






**** Back up Figure -- Map 

clear 
use Data_Law_08132018.dta, clear
merge 1:1 country_year using Data_Controls_10112017, force
drop if _merge==2
drop _merge

keep if year==2010
* keep if national_law_coded_ever==1
keep if regional_group==0

kountry country, from(other) stuck
ren _ISO3N_ iso3n
kountry iso3n, from(iso3n) to(iso3c)
ren _ISO3C_ ISO3
replace ISO3="JEY" if country=="Jersey Channel Islands"
drop if ISO3==""

merge 1:1 ISO3 using worlddb
drop if NAME=="Antarctica"
drop if _merge==2


gen neither= 1
gen efficiency= 0
gen other= 0
gen  both= 0

replace efficiency=1 if merger_efficiency_def==1 
replace efficiency = 0 if merger_pubint_def!=0

replace other = 1 if merger_pubint_def==1
replace other=0 if  merger_efficiency_def==1 

replace both =1 if merger_efficiency_def==1 |  merger_pubint_def ==1 
replace both =0 if efficiency==1 | other==1

replace neither =0 if efficiency==1 | both==1 | other ==1

gen overall=1
replace overall=2 if efficiency==1
replace overall=3 if other==1
replace overall=4 if both==1
replace overall =5 if neither==1
replace overall=1 if national_law_coded_ever==0
tab overall

tab year

#delimit;
*P_corr_usa;
spmap overall using worldcoord,
	id(_ID) clm(custom) clb(1 1.9 2 3 4 5) graphregion(fcolor(white) color(white))
	fcolor(white "255 180 180" "0 192 255" "0 128 255" "0 0 205" gray) legtitle("Resemblence") name(p_corr_usa, replace)
	legend(label(2 "No Law") label(3 "Efficiency") label(4 "Public Interest") label(5 "Both") label(6 "Neither") pos(9) symy(5) symx(3) textw(10) size(2.3));
graph export "p_corr_usa.pdf", replace;


